#ifndef COMMAND_H_
#define COMMAND_H_

#include <string>
#include <vector>
#include <sstream>
#include <cstring>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#include <stdio.h>
#include <stdlib.h>

#include "Commands.h"
#include "BuiltInCommand.h"

using std::string;
using std::vector;


class BuiltInCommand;

class Command {
private:
	int priority;
	void executeCommand();

protected:
	string path_str;
	string command_str;
	string outputFile;
	vector<string> * arguments;
	bool isOutputFlag;
	bool isInputFlag;
	bool append;
	bool buildIn;
	bool writeToFile;

	BuiltInCommand* buildInCommand;
	const char* expressions[COMMANDS_SIZE];

public:
	Command(string);
	virtual ~Command();
	string getText();
	void execute();
	void setIsAppend();
	bool isAppend();
	string findPath(string );
	void split(vector<string> *, string);
	void setOutputFile(string filename);
	void setInputFile(string filename);
	void addArgument(string);
	void setPriority( int );
	bool isBuildInCommand( const char* );
	void executeBuiltInCommand( const char*, int, char* const* );
	void executeBuildInCommand();

};

#endif /* COMMAND_H_ */
